<?php  
namespace app\index\controller;
class News extends Base{
	public function news(){
		// halt(input());
		// if(empty($_GET['typeclass'])){
		// 	$_GET['typeclass']=$classify[0]['typeclass'];
		// }
		$arr2=db('news')->find($_GET['id']);
		$arr=db('news')->where('type=1')->where('typeclass',$arr2['typeclass'])->paginate(10);
		// halt($arr);
		return view('',['arr2'=>$arr2,'arr'=>$arr]);
	}
	public function news_details(){
		$arr2=db('news')->find($_GET['id']);
		$arr=db('news')->where('type=2')->where('title',$arr2['title'])->where('audit','pass')->paginate(3,false,['query'=>input("get.")]);
		return view('',['arr2'=>$arr2,'arr'=>$arr]);
	}
	public function newscomment_add(){
		$_POST['type']=2;
		// halt(input());

		$arr=db('news')->where('title',$_POST['title'])->find();
		$_POST['typeclass']=$arr['typeclass'];
		db('news')->insert($_POST);
		// return view('news_details',['title'=>$_POST['title'],'typeclass'=>$arr['typeclass']]);
		// $this->success('评论成功，等待审核中',"news_details?tilte=$_POST['title']&typeclass=$arr['typeclass']");
		$this->redirect("news_details",['id'=>$arr['id']]);
	}
}
?>